#ifndef RESFILE_H
#define RESFILE_H

#include <QList>
#include <QObject>
#include <QSettings>

class ResFile
{

public:
    ResFile();
    ResFile(QDataStream &data);
    void setData(QDataStream &data);

    QString Name;
    QByteArray Md5;
    int64_t Size = 0;
};

class ResFileMgr : public QObject
{
    Q_OBJECT
public:
    ResFileMgr(){
//        config.beginGroup("main");
    }

    void downloadBin();
    bool loadFile(const QString& path);
    bool loadFormLocalDir(const QString& dirPath);

    void append(const ResFile& file);


    const QMap<QString, ResFile> &getResList() const;
    qint64 getTotalBytesCount();
    void setResList(const QMap<QString, ResFile> &newResList);

    QByteArray calculateFileMd5(const QString &filePath);

signals:
    void sigBinDownload();

private:
    QMap<QString,ResFile> resList;

    int64_t Version;
    int32_t count;
    qint64 TotalBytesCount = 0;

//    QSettings config{".set.ini",QSettings::IniFormat};
};


#endif // RESFILE_H
